package com.example.administrator.demo_weather;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;

/**
 * Created by Administrator on 2018/6/1/001.
 */

public class StreamTools {
    public String readStream(InputStream is) throws Exception{
        ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream();
        byte[] buffer=new byte[1024];
        int len=-1;
        while ((len=is.read(buffer))!=-1){
            byteArrayOutputStream.write(buffer,0,len);
        }
        is.close();
        return byteArrayOutputStream.toString();
    }
}
